<!DOCTYPE html>
<html lang="en">
<!-- 
    @author: 姜存浩
    @title: 货物进出口总额
 -->
<head>
    <meta charset="UTF-8">
    <title>货物进出口总额</title>
    <!-- 引入Jquery -->
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

    <!-- 引入Bootstrap -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

    <!-- 引入BootStrap-table -->
    <link rel="stylesheet" href="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.css">
    <script src="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.js"></script>

    <!-- 引入Bootstrap-paginator -->
    <script src="../assets/libs/bootstrap-paginator-master/build/bootstrap-paginator.min.js"></script>

    <!-- 引入Echarts -->
    <script src="../assets/libs/echarts/echarts.min.js"></script>
    <style type="text/css">
    	.th-inner{
    		text-align: center;
    	}
    </style>
</head>
<body>
    <div class="container">
        <div>
            <ul class="nav nav-tabs">
                <li role="presentation" id="tableTag"><a href="javascript:;" onclick="showTable()">&nbsp;<span class="glyphicon glyphicon-th-large"></span>&nbsp;</a></li>
                <li role="presentation" id="imageTag"><a href="javascript:;" onclick="showImage()">&nbsp;<span class="glyphicon glyphicon-tasks"></span>&nbsp;</a></li>
            </ul>
        </div>

        <div id="tableView">
            <div class="page-header" style="text-align: center;">
                <h3>货物进出口总额</h3>
                <br>
                <h4 style="margin-top: -20px;">Merchandise Imports and Exports</h4>
            </div>

            <div style="text-align: right;">单位:&nbsp;%</div>
            <table id="tableData" style="text-align: center;"></table>
        </div>

        <div id="imageView">
            <div class="page-header" style="text-align: center;">
                <h3>货物进出口总额</h3>
                <br>
                <h4 style="margin-top: -20px;">Merchandise Imports and Exports</h4>
            </div>

            <div class="panel" style="margin-top: 1.5em;">
            <!--    <div style="text-align: right;">单位:&nbsp;%</div>-->
                <div id="main" style="width: 100%;height:400px;"></div>
            </div>
        </div>

         <div style="color: #959595; margin-top: 1.5em;">*此数据仅展现最近五年，若需全部数据请点击&nbsp;<a href="#" class="btn btn-info btn-xs">
        <span class="glyphicon glyphicon-save"></span> 下载
    </a></div>



        <!-- <div style="text-align: right;"><div id="page"></div></div> -->
    </div>
    <script>
        $(function(){
            $('#imageView').hide();
            $('#tableTag').attr('class','active');
        })

        function showTable() {
            $('#tableView').show();
            $('#imageView').hide();
            $('#tableTag').attr('class','active');
            $('#imageTag').removeClass('active');
        }

        function showImage() {
            $('#imageView').show();
            $('#tableView').hide();
            $('#imageTag').attr('class','active');
            $('#tableTag').removeClass('active');
        }

        $('#tableData').bootstrapTable({
            striped: true,
            columns: [
                {
                    field: 'country',
                    title: '国家'
                },
                {
                    field: 'year1',
                    title: '2010年'
                },
                {
                    field: 'year2',
                    title: '2011年'
                },
                {
                    field: 'year3',
                    title: '2012年'
                },
                {
                    field: 'year4',
                    title: '2013年'
                },
                {
                    field: 'year5',
                    title: '2014年'
                },
                {
                    field: 'year6',
                    title: '2015年'
                },
            ],
            data: [
                {
                    country: "阿尔巴尼亚",
					year1: "5.15",
					year2: "8.13",
					year3: "7.1",
					year4: "6.63",
					year5: "6.71",
					year6: "12.58",
                },
                {
                    country: "爱沙尼亚",
					year1: "3.49",
					year2: "4.38",
					year3: "6.16",
					year4: "8.52",
					year5: "9.50",
					year6: "10.51",
                },
                {
                    country: "保加利亚",
					year1: "7.08",
					year2: "9.02",
					year3: "10.92",
					year4: "11.74",
					year5: "12.46",
					year6: "21.82",
                },
                {
                    country: "波兰",
					year1: "4.31",
					year2: "8.64",
					year3: "13.24",
					year4: "17.24",
					year5: "10.98",
					year6: "13.55",
                },
                {
                    country: "黑山",
					year1: "11.18",
					year2: "4.61",
					year3: "8.41",
					year4: "9.61",
					year5: "6.18",
					year6: "12.29",
                },
                {
                    country: "捷克",
					year1: "5.57",
					year2: "4.65",
					year3: "6.86",
					year4: "9.66",
					year5: "7.44",
					year6: "7.75",

                },
                {
                   country: "克罗地亚",
					year1: "9.97",
					year2: "12.84",
					year3: "9.73",
					year4: "9.01",
					year5: "9.02",
					year6: "8.72",
                },
                {
                    country: "拉脱维亚",
					year1: "2.98",
					year2: "6.21",
					year3: "1.55",
					year4: "8.83",
					year5: "7.82",
					year6: "10.25",
                },
                {
                    country: "立陶宛",
					year1: "5.02",
					year2: "4.81",
					year3: "8.46",
					year4: "4.75",
					year5: "3.16",
					year6: "11.32",
                },
                {
                    country: "罗马尼亚",
					year1: "3.83",
					year2: "2.59",
					year3: "4.61",
					year4: "4.65",
					year5: "7.95",
					year6: "7.51",

                },
                {
                   country: "马其顿",
					year1: "3.65",
					year2: "8.55",
					year3: "4.10",
					year4: "3.70",
					year5: "4.65",
					year6: "9.64",
                },
                {
                    country: "塞尔维亚",
					year1: "5.28",
					year2: "8.00",
					year3: "6.16",
					year4: "4.52",
					year5: "5.40",
					year6: "5.46",
                },
                {
                    country: "斯洛伐克",
					year1: "15.77",
					year2: "4.19",
					year3: "6.76",
					year4: "2.29",
					year5: "5.65",
					year6: "7.86",
                },
                {
                    country: "斯洛文尼亚",
					year1: "1.98",
					year2: "0.26",
					year3: "9.98",
					year4: "3.67",
					year5: "6.68",
					year6: "3.78",
                },
                {
                    country: "匈牙利",
					year1: "4.40",
					year2: "6.64",
					year3: "8.79",
					year4: "5.51",
					year5: "6.34",
					year6: "5.37",
                },
                {
                    country: "波黑",
					year1: "7.41",
					year2: "8.97",
					year3: "5.65",
					year4: "8.37",
					year5: "9.76",
					year6: "10.42",
                }
            ]
        });

        var all = {
            "data": [
                [5.15,3.49,7.08,4.31,11.18,5.57,9.97,2.98,5.02,3.83,3.65,5.28,15.77,1.98,4.4,7.41],
                [8.13,4.38,9.02,8.64,4.61,4.65,12.84,6.21,4.81,2.59,8.55,8,4.19,0.26,6.64,8.97],
                [7.1,6.16,10.92,13.24,8.41,6.86,9.73,1.55,8.46,4.61,4.1,6.16,6.76,9.98,8.79,5.65],
                [6.63,8.52,11.74,17.24,9.61,9.66,9.01,8.83,4.75,4.65,3.7,4.52,2.29,3.67,5.51,8.37],
                [6.71,9.5,12.46,10.98,6.18,7.44,9.02,7.82,3.16,7.95,4.65,5.4,5.56,6.68,6.34,9.76],
                [12.58,10.51,21.82,13.55,12.29,7.75,8.72,10.25,11.32,7.51,9.46,5.46,7.86,3.78,5.37,10.42],
                []
            ],
            "countrys": ["阿尔巴尼亚","爱沙尼亚","保加利亚","波兰","黑山","捷克共和国","克罗地亚","拉脱维亚","立陶宛","罗马尼亚","马其顿","塞尔维亚","斯洛伐克","斯洛文尼亚","匈牙利","波黑"],
            "years": ["2010年", "2011年", "2012年", "2013年", "2014年", "2015年"]
        };

        var option = {
            timeline: {
                axisType: 'category',
                autoPlay: true,
                playInterval: 2000,
                data: all.years
            },
            options: [{
                tooltip: {
                    trigger: 'axis'
                },title:{
                	subtext:'数据来源'
                }
                ,
                calculable: true,
                grid: {
                   top:50,
                   bottom:100
                },
                xAxis: [{
                    type: 'category',
                    axisLabel: {
                        interval: 0
                    },
                    data: all.countrys
                }],
                yAxis: [{
                    type: 'value',
                    name: '单位: %'
                }],
                series: [{
                    name: '货物进出口总额',
                    type: 'bar',
                    data: all.data[0]
                }]
            },
                {
                    series: [{
                        data: all.data[1]
                    }]
                },
                {
                    series: [{
                        data: all.data[2]
                    }]
                },
                {
                    series: [{
                        data: all.data[3]
                    }]
                },
                {
                    series: [{
                        data: all.data[4]
                    }]
                },
                {
                    series: [{
                        data: all.data[5]
                    }]
                }
            ]
        };
        var myChart = echarts.init(document.getElementById('main'));
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>